home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Merciful 5
/
Merciful - Disc 5.iso
/
software
/
r
/
real_3d
/
real3dv3.3b.dms
/
real3dv3.3b.adf
/
GUI.LZH
/
GUI
/
surface.gui
< prev
Wrap
Text File
|
1995-05-04
|
6KB
|
247 lines
(
( Interface for creating 'SURFACE' animation method applications
(
?& SURFACE_GUI NOT ?IF
1 CONSTANT SURFACE_GUI
"ui.rpl" LOAD
"locks.rpl" LOAD
( Global variables
VARIABLE asuWindow
VARIABLE asuTarget
VARIABLE asuGravity
VARIABLE asuGround
VARIABLE asuApply
VARIABLE asuHelp
VARIABLE asuCancel
VARIABLE isuFlags
VARIABLE asuText
VARIABLE asuTxtTarget
VARIABLE asuTxtGravity
VARIABLE asuTxtGround
VARIABLE isuStampIndex
( these variables points to selected objects
400 STRING ssuTarget
400 STRING ssuGravity
400 STRING ssuGround
( flags for disabling buttons
1 CONSTANT fsuTarget
2 CONSTANT fsuGravity
4 CONSTANT fsuGround
fsuTarget fsuGravity fsuGround BOR BOR CONSTANT fsuAll
1 CONSTANT TRUE
0 CONSTANT FALSE
0 CONSTANT NULL
( this enables apply when isuFlags is equal to fsuAll
: suEnableApply
isuFlags FETCH fsuAll =
IF
UI_Done "Select friction points and click Apply" UITX_Text asuText FETCH UI_SETATTRS
UI_Done FALSE UI_Disabled asuApply FETCH UI_SETATTRS
ENDIF
;
( saves the name of selected object to given string buffer
: suStoreSelected
PARAM
VARIABLE ssuName
ENDPARAM
iLOCK_SHARED O_LOCK
O_GETSEL DUP IF
ssuName FETCH O_MAKENAME
DROP
1
ENDIF
iLOCK_REMOVE O_LOCK
;
( Callbacks for Gadgets
: sucbTarget
ssuTarget suStoreSelected
IF
UI_Done TRUE UI_Disabled asuTarget FETCH UI_SETATTRS
UI_Done ssuTarget UITX_Text asuTxtTarget FETCH UI_SETATTRS
UI_Done "Target defined" UITX_Text asuText FETCH UI_SETATTRS
isuFlags FETCH fsuTarget BOR isuFlags STORE
suEnableApply
ELSE
UI_Done "No target object selected" UITX_Text asuText FETCH UI_SETATTRS
ENDIF
;
: sucbGravity
ssuGravity suStoreSelected
IF
UI_Done TRUE UI_Disabled asuGravity FETCH UI_SETATTRS
UI_Done ssuGravity UITX_Text asuTxtGravity FETCH UI_SETATTRS
UI_Done "Gravity defined" UITX_Text asuText FETCH UI_SETATTRS
isuFlags FETCH fsuGravity BOR isuFlags STORE
suEnableApply
ELSE
UI_Done "No gravity object selected" UITX_Text asuText FETCH UI_SETATTRS
ENDIF
;
: sucbGround
ssuGround suStoreSelected
IF
UI_Done TRUE UI_Disabled asuGround FETCH UI_SETATTRS
isuFlags FETCH fsuGround BOR isuFlags STORE
UI_Done ssuGround UITX_Text asuTxtGround FETCH UI_SETATTRS
UI_Done "Ground defined" UITX_Text asuText FETCH UI_SETATTRS
suEnableApply
ELSE
UI_Done "No ground object selected" UITX_Text asuText FETCH UI_SETATTRS
ENDIF
;
: sucbHelp
"emacs r3d3:gui/surface.gui" SYSTEM
;
: suCreateLink
PARAM
VARIABLE aObject
ENDPARAM
100 STRING sStamp
( build up date stamp used for linking objects
isuStampIndex FETCH DUP 1 + isuStampIndex STORE
DATETIME "%d %d:%d:%d %d-%d-%d" sStamp SPRINTF
( create a link object with the time stamp
"link" 0 "CEND" sStamp "SIDE" C_LINK DROP
( add time stamp to target object
aObject FETCH "CEND" sStamp "SIDE" O_CREATAG DROP
;
: suCreateMethod
400 STRING sTmpName
iLOCK_EXCL O_LOCK
ssuTarget O_FIND O_GETPAR O_CURRENT DROP
( create the actual surface method
2 "DRAG" 0 "CEND" "DRAG" "SMTH" C_LEVEL O_CURRENT DROP
( push currently selected objects on the stack
O_GETSEL
( gravity is the first parameter object
0 ssuGravity O_FIND M_CUT
O_GETCURR 0 M_PASTE
( ground is the second param object
0 ssuGround O_FIND M_CUT
O_GETCURR 0 M_PASTE
( third parameter object is a level consisting of links to friction points
2 "links" 0 "CEND" C_LEVEL O_CURRENT DROP
( scan through selected objects and create links
BEGIN
DUP
WHILE
suCreateLink
REPEAT
DROP
iLOCK_REMOVE O_LOCK
;
: sucbApply
( enable other buttons
UI_Done FALSE UI_Disabled asuTarget FETCH UI_SETATTRS
UI_Done FALSE UI_Disabled asuGravity FETCH UI_SETATTRS
UI_Done FALSE UI_Disabled asuGround FETCH UI_SETATTRS
( clear object names
UI_Done "" UITX_Text asuTxtTarget FETCH UI_SETATTRS
UI_Done "" UITX_Text asuTxtGravity FETCH UI_SETATTRS
UI_Done "" UITX_Text asuTxtGround FETCH UI_SETATTRS
( disable apply
UI_Done TRUE UI_Disabled asuApply FETCH UI_SETATTRS
( clear flags
0 isuFlags STORE
( do the actual job
UI_Done "Creating surface method ..." UITX_Text asuText FETCH UI_SETATTRS
suCreateMethod
UI_Done "Done" UITX_Text asuText FETCH UI_SETATTRS
;
: sucbCancel
asuWindow FETCH UI_DELETE
NULL asuWindow STORE
;
: sucbWindow
PARAM
VARIABLE iMouseY
VARIABLE iMouseX
VARIABLE iEvent
ENDPARAM
iEvent FETCH UIWM_Close =
IF
asuWindow FETCH UI_DELETE
NULL asuWindow STORE
ENDIF
;
?ENDIF
asuWindow FETCH
?IF
"Alright" "Window is already open" GET_KEY DROP
?ELSE
( create a window
UI_Done & sucbWindow 0 0 520 120 "Create Surface Animation Object" UI_WINDOW asuWindow STORE
( create text gadgets
UI_Done TRUE UITX_Border asuWindow FETCH 0 100 20 300 12 "Target" UI_TEXT asuTxtTarget STORE
UI_Done TRUE UITX_Border asuWindow FETCH 0 100 35 300 12 "Gravity" UI_TEXT asuTxtGravity STORE
UI_Done TRUE UITX_Border asuWindow FETCH 0 100 50 300 12 "Ground" UI_TEXT asuTxtGround STORE
( create buttons
UI_Done asuWindow FETCH & sucbTarget 400 20 100 12 "Target" UI_BUTTON asuTarget STORE
UI_Done asuWindow FETCH & sucbGravity 400 35 100 12 "Gravity" UI_BUTTON asuGravity STORE
UI_Done asuWindow FETCH & sucbGround 400 50 100 12 "Ground" UI_BUTTON asuGround STORE
UI_Done asuWindow FETCH & sucbApply 5 100 100 12 "Apply" UI_BUTTON asuApply STORE
UI_Done asuWindow FETCH & sucbHelp 200 100 100 12 "Help" UI_BUTTON asuHelp STORE
UI_Done asuWindow FETCH & sucbCancel 400 100 100 12 "Cancel" UI_BUTTON asuCancel STORE
UI_Done
TRUE UITX_Border
"Use select window and buttons above to select four objects" UITX_Text
asuWindow FETCH 0 100 80 400 12 "Status" UI_TEXT asuText STORE
( realize gadgets
asuWindow FETCH UI_REALIZE
( disable apply
UI_Done TRUE UI_Disabled asuApply FETCH UI_SETATTRS
?ENDIF ( SURFACE_GUI